using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace eYap.src.Forms
{
    public partial class AddAccountControl : UserControl
    {
        AccountManager parentForm;
        public AddAccountControl(AccountManager acm)
        {
            InitializeComponent();
            cBox_Protocol.SelectedIndex = 0;
            parentForm = acm;
        }

        private void btn_Save_Click(object sender, EventArgs e)
        {
            if(cBox_Protocol.SelectedItem.ToString() == SettingsManager.Protocol.Facebook.ToString())
            {
                Account account = new Account(tbox_username.Text, tbox_password.Text, SettingsManager.Protocol.Facebook);
                SettingsManager.SaveAccountSettings(account);
                SettingsManager.ACCOUNTS.Add(account);
            }
            
            this.Hide();
            parentForm.btn_AddAccount.Show();
            parentForm.btn_RemAccount.Show();
            parentForm.btn_EditAccount.Show();
            parentForm.PopulateAccountList();
        }


        private void btn_Cancel_Click(object sender, EventArgs e)
        {
            this.Hide();
            parentForm.btn_AddAccount.Show();
            parentForm.btn_RemAccount.Show();
            parentForm.btn_EditAccount.Show();
            parentForm.gBox_AccActions.Controls.Remove(this);
        }
    }
}
